/*
 * @Author: 郭招娣 10615594+guo-zhaodi@user.noreply.gitee.com
 * @Date: 2022-09-01 19:30:44
 * @LastEditors: 郭招娣 10615594+guo-zhaodi@user.noreply.gitee.com
 * @LastEditTime: 2022-09-02 09:49:18
 * @FilePath: \app\src\components\ProductAll\ProductText.tsx
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import React from 'react'
import { Image, Typography, } from 'antd'
import { withRouter, RouteComponentProps,} from 'react-router-dom'
interface Props extends RouteComponentProps {
    id:number|string
    title:string
    price:string|number
    images:string
    size:'large'|'small'
}
const ProductTextComponent: React.FC<Props> = ({ images, size, id, title, price, history })=> {
  return (
      <div onClick={() => history.push(`/detail/${id}`)}>
         
              {
                  size === 'large' ? (
                      <Image src={images} height={285} width={530} />
                  ) : (
                      <Image src={images} height={120} width={260} />
                  )
              }
        
          <Typography.Text>{title.slice(0,18)+'...'}</Typography.Text>
          <Typography.Text style={{color:'red'}}>￥{price}起</Typography.Text>
    </div>
  )
}
export const ProductText = withRouter(ProductTextComponent)